<?php  echo $this->Session->flash();?>

<div class="row">
	<div class="col-lg-12">
		<h2 class="page-header"><?php echo $title_for_layout?></h2>
	</div>
</div>
<?php echo $this->Form->create('Faqs', array('action' => 'edit/'.$detail['Faqs']['id'], 'method' => 'post', 'id'=>'edit', 'type' => 'file')); ?>
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
	<tr>
		<th width="15%">Câu hỏi</th>
		<td>
			<?php
			echo $this->Form->textarea('question', array(
					'label' => false,
					'required' => false,
					'rows'=> 4,
					'cols'=> 70,
					'value'=> $detail['Faqs']['question'],
			));
			?>
		</td>
	</tr>

	<tr>
		<th>Category</th>
		<td>
			<div class="category_type">
				<select name="data[Faqs][category_id]" id="category_id" class="form-control">
					<option value="0">--[category]--</option>
					<?php
					foreach($listCategory as $cat):
					?>
						<option <?php if($detail['Faqs']['category_id'] == $cat["id"]) echo 'selected="selected"';?> value="<?php echo $cat["id"]?>" >
						<?php
						for($j=0; $j < $cat["level"]; $j++) echo "---";
							echo $cat["cat_name"];
						?>
						</option>
					<?php
					endforeach;
					?>
				</select>
			</div>
		</td>
	</tr>
	<tr>
		<th>Tên người hỏi</th>
		<td>
		<?php
			echo $this->Form->input('name', array(
					'type' => 'text',
					'label' => false,
					'class' => 'form-control w400',
					'required' => false,
					'id'=> 'title_seo',
					'value'=> $detail['Faqs']['name'],
			));
		?>
		</td>
	</tr>
	<tr>
		<th>Email người hỏi</th>
		<td>
		<?php
			echo $this->Form->input('email', array(
					'type' => 'text',
					'label' => false,
					'class' => 'form-control w400',
					'required' => false,
					'id'=> 'title_seo',
					'value'=> $detail['Faqs']['email'],
			));
		?>
		</td>
	</tr>
	<tr>
		<th>Trả lời</th>
		<td>
			<?php
				echo $this->Form->textarea('answer', array(
					'label' => false,
					'class' => 'ckeditor',
					'id' => 'editor1',
					'required' => false,
					'rows'=> 4,
					'cols'=> 70,
					'value'=> $detail['Faqs']['answer'],
				));
			?>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>
			<div class="form-group">
			<?php
			echo $this->Form->button('Submit', array(
				'type' => 'submit',
				'class' => 'btn btn-primary',
				'label' => false,
				'div' => false,
			)
			).'  ';

			echo $this->Form->button('Reset', array(
					'type' => 'reset',
					'class' => 'btn btn-primary',
					'label' => false,
					'div' => false,
				)
			);
			?>
			</div>
		</td>
	</tr>
</table>
<?php echo $this->Form->end()?>
<script type="text/javascript">
if (typeof CKEDITOR != 'undefined') {
    var editor = CKEDITOR.replace( 'editor1' );
    CKFinder.setupCKEditor( editor, '/js/ckfinder/' ) ;
}
</script>

